Skip to content

refactor: name the two halves of a plan precompute and query - #783

Open
zzylol wants to merge 1 commit into
mainfrom
refactor/precompute-query-vocabulary
Open

zzylol wants to merge 1 commit into
mainfrom
refactor/precompute-query-vocabulary

Conversation

@zzylol

@zzylol zzylol commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

A plan is cut once: what runs ahead of the query, and what runs at query time. The backend had four names for the first half and a different word entirely for the second, and neither matched the fields in PhysicalCandidate that Planner hands it.

Planner (PhysicalCandidate) backend before backend after
first half precompute executable_dags, InstalledPostAsapDag, maintenance (validator + schema constant), RawDagProgram precompute
second half query residual query_time

Why residual had to go

It is also Planner's word, for something else. ExactWindowEdgeResidual is the exact computation covering the partial panes at a window's two edges; it has nothing to do with this cut. Two repositories used one word for two concepts.

Why precompute and not maintenance

The crates already separate these by layer, and only the names blurred it:

  • asap-aware-mapping::summary_maintenance_* owns the Summary Maintenance Lifecycle: how state is built, retained, reused, scheduled.
  • asap-physical-operators::physical_planner owns the DAGs a lifecycle compiles to, and calls this half precompute.

The backend's own BackendExecutableBinding already said precompute_sinks. Lifecycle vocabulary is untouched here.

Not renamed, deliberately

Three sites keep the word because they mean something else:

  • residuals on a KLL sketch: the sketch's own array.
  • let residual = a - b - c in sketch_db_diag.rs: arithmetic.
  • "typed-local-residual-v3-counter-index" in compiler.rs:1630: a hash seed. Its bytes feed a stored identity, so renaming it would silently invalidate persisted fingerprints.

Scope and safety

Identifiers and prose only. residual never appears in a serde(rename = ...), so no serialized value changes.

23 files, +288 / −277. Rebased onto main after #774 merged, so it covers the shared-operator code too.

cargo build -p control_plane -p data_plane, cargo fmt --check, cargo clippy --all-targets with -D warnings, and cargo test -p control_plane --lib (433 passed) all clean.

Upstream

ASAPPlanner #462 draws the same line: its design doc section is now "Precompute Physical DAG" beside "Query Physical DAG", and its physical-layer comments say precompute for this half.

🤖 Generated with Claude Code

A plan is cut once, into what runs ahead of the query and what runs at query
time. The backend had four names for the first half and a different word
entirely for the second, and neither matched the field names in
PhysicalCandidate that Planner hands it.

The query half was called `residual`. That word is also Planner's, for
something else: ExactWindowEdgeResidual is the exact computation covering the
partial panes at a window's two edges, which has nothing to do with this cut.
Call it query-time, which is what it is.

The precompute half answered to `executable_dags`, InstalledPostAsapDag,
`maintenance` in its own validator and schema constant, and RawDagProgram in
the engine, while its own binding type already said `precompute_sinks`. Use
precompute throughout, matching PhysicalCandidate::precompute.

Identifiers and prose only; no serialized value changes. Verified `residual`
never appears in a serde rename. Three sites keep the word because they mean
something else entirely: `residuals` on a KLL sketch is the sketch's own array,
`let residual = a - b - c` in the diagnostic example is arithmetic, and
"typed-local-residual-v3-counter-index" in compiler.rs is a hash seed whose
bytes feed a stored identity, so renaming it would silently invalidate
persisted fingerprints.

Lifecycle vocabulary is untouched. "Summary Maintenance Lifecycle" names how
state is built, retained, reused and scheduled; a precompute DAG is the
physical object a lifecycle compiles to. ASAPPlanner #462 draws the same line
upstream, and its design doc and physical-layer comments now say precompute for
this half.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant